package com.wzdigit.wms.basic.mapper.core.basic;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.wms.basic.domain.basic.Warehouse;
import com.wzdigit.wms.basic.client.request.basic.SearchWarehouseRequest;
import com.wzdigit.wms.basic.client.response.basic.UserDataPermissionResponse;
import com.wzdigit.wms.basic.client.response.basic.WarehouseApiResponse;
import com.wzdigit.wms.basic.client.response.basic.WarehouseResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 仓库 Mapper 接口
 * </p>
 *
 * @author
 * @since 2020-12-28
 */
@MyBatisRepository
public interface WarehouseMapper extends BaseMapper<Warehouse> {

	List<UserDataPermissionResponse> selectPerms(@Param("userId") Integer userId, @Param("udf1") String udf1);
	
	@SuppressWarnings("rawtypes")
	List<WarehouseResponse> selectAll(@Param("dto") SearchWarehouseRequest dto, @Param("whsIdList") List<Integer> whsIdList);
	
	WarehouseResponse selectOneByWhsId(@Param("whsId") Integer whsId);

	List<WarehouseApiResponse> selectAllByUserIdAndWhsType(@Param("userId") Integer userId, @Param("whsType") Integer whsType);
	
	List<WarehouseApiResponse> selectAllByStatus(@Param("status") Integer status);

	Warehouse selectOneByWhsCode(@Param("whsCode") String whsCode);

	Warehouse selectOneByWhsName(@Param("whsName") String whsName);
	
	Warehouse selectOneByZoneId(@Param("zoneId") Integer zoneId);
	
	Warehouse selectOneByLocCode(@Param("locCode") String locCode);
	
	int updateStatus(Warehouse record);
	
	int deleteByPrimaryKey(Integer whsId);

	int insert(Warehouse record);

	Warehouse selectByPrimaryKey(Integer whsId);

	int updateByPrimaryKeySelective(Warehouse record);

	int updateByPrimaryKey(Warehouse record);
	
	List<String> getWhsNameByWhsIdList(@Param("whsIdList") List<Integer> whsIdList);

    List<Integer> selectZoneIdsByUserName(@Param("userName") String userName);
}
